import taichi as ti

ti.init(arch =ti.cuda)

#若想要把python处的数据变动 让kernel能够接收到 需要定义一个全局field量 
a = ti.field(ti.i32,shape =())

@ti.kernel
def foo():
    print('a=',a[None])

a[None] = 43
foo()
a[None] = 55
foo()